﻿using RuoVea.ExUtil;

namespace RuoVea.Tool.Model
{
    /// <summary>
    /// 
    /// </summary>
    public class IndexMenus
    {
        /// <summary>
        /// 菜单
        /// </summary>
        /// <param name="code"></param>
        /// <param name="navName"></param>
        /// <returns></returns>
        public static List<MenuModel> Menus(string code, string navName)
        {
            List<MenuModel> menus = new List<MenuModel> {
            new MenuModel{ Link = "/AndroidManifest", Name = "Android Manifest功能与权限描述", Position = "0px 0px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/Ascii", Name = "ASCII码对照表", Position = "0px -50px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/ContentType", Name = "HTTP Content type 对照表", Position = "0px -100px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/Eascii", Name = "EASCII码对照表", Position = "0px -150px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/FeeSymbol", Name = "表情符号,动植物符号", Position = "0px -200px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/FontTable", Name = "网页常用字体", Position = "0px -250px;", catorgry = new Catorgry { Code = "designer", Name = "文档类" } },
            new MenuModel{ Link = "/GB2312", Name = "GB2312简体中文编码表", Position = "0px -300px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/GbkTable", Name = "GBK编码表/GBK字符集", Position = "0px -350px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/HtmlChar", Name = "HTML特殊符号对照表", Position = "0px -400px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/HtmlEscape", Name = "HTML/XML转义字符", Position = "0px -450px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },

            new MenuModel{ Link = "/HttpCode", Name =  "HTTP状态码详解", Position = "0px -500px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/HttpRequest", Name = "HTTP请求方法大全", Position = "0px -550px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/HttpMimeType", Name = "HTTP协议-MIME类型", Position = "0px -600px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/HttpHeader", Name = "HTTP请求头大全", Position = "0px -650px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },

            new MenuModel{ Link = "/JsEscape", Name = "JavaScript转义字符对照表", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/JsEvent", Name = "javascript事件与功能说明", Position = "0px -750px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/KeyCodesNum", Name = "键盘与鼠标按键的键值", Position = "0px -800px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },

            new MenuModel{ Link = "/PhpFun", Name = "php在线函数", Position = "0px -850px;", catorgry = new Catorgry { Code = "developer", Name = "文档类" } },
            new MenuModel{ Link = "/Priority", Name = "编程语言运算符优先级", Position = "0px -900px;", catorgry = new Catorgry { Code = "developer", Name = "文档类" } },
            new MenuModel{ Link = "/PublicDns", Name = "公共DNS说明表", Position = "0px -950px;", catorgry = new Catorgry { Code = "webmaster", Name = "文档类" } },

            new MenuModel{ Link = "/Symbol", Name = "特殊符号大全", Position = "0px -1000px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/TcpUdpPort", Name = "常见TCP/UDP端口", Position = "0px -1050px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },
            new MenuModel{ Link = "/WcComponent", Name = "微信小程序组件", Position = "0px -1100px;", catorgry = new Catorgry { Code = "document", Name = "文档类" } },

            new MenuModel{ Link = "/School", Name = "高校查询", catorgry = new Catorgry { Code = "inquiry", Name = "查询类" } },

            new MenuModel{ Link = "/Sketching", Name = "在线素描生成", catorgry = new Catorgry { Code = "image"} },

            new MenuModel{ Link = "/Base16", Name = "在线Base16编码解码", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/Base32", Name = "在线Base32编码解码", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/Base58", Name = "在线Base58编码解码", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/Base62", Name = "在线Base62编码解码", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/Base64", Name = "在线Base64编码解码", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/Base91", Name = "在线Base91编码解码", catorgry = new Catorgry { Code = "text"} },

            new MenuModel{ Link = "/Diffview", Name = "文本比较工具", catorgry = new Catorgry { Code = "developer"} },

            new MenuModel{ Link = "/ChatEnc", Name = "在线聊天内容加密", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/PassCreater", Name = "高强度密码生成器", catorgry = new Catorgry { Code = "developer"} },

            new MenuModel{ Link = "/JsEncode", Name = "JS在线(eval方法)工具", catorgry = new Catorgry { Code = "developer"} },
            new MenuModel{ Link = "/JsEncode2", Name = "JS在线加密混淆", catorgry = new Catorgry { Code = "developer"} },

            new MenuModel{ Link = "/Md5", Name = "MD5在线加密工具", catorgry = new Catorgry { Code = "text"} },
            new MenuModel{ Link = "/Md5_2", Name = "MD5在线加密工具", catorgry = new Catorgry { Code = "text"} },

            new MenuModel{ Link = "/Periodic", Name = "化学元素周期表", catorgry = new Catorgry { Code = "academic"} },
            new MenuModel{ Link = "/Dynasty", Name = "历史朝代表", catorgry = new Catorgry { Code = "academic"} },
            new MenuModel{ Link = "/Capital", Name = "各国首都位置", catorgry = new Catorgry { Code = "academic"} },

            new MenuModel{ Link = "/Symkey", Name = "键盘符号英文", catorgry = new Catorgry { Code = "inquiry"} },
            new MenuModel{ Link = "/Passsafe", Name = "密码安全性在线检测", catorgry = new Catorgry { Code = "inquiry"} },

            new MenuModel{ Link = "/Urlreth", Name = "迅雷,快车,旋风URL加解密", catorgry = new Catorgry { Code = "developer"} },
            new MenuModel{ Link = "/Useragents", Name = "PC/移动UserAgent", catorgry = new Catorgry { Code = "developer"} },
            new MenuModel{ Link = "/Csspack", Name = "CSS压缩/格式化", catorgry = new Catorgry { Code = "developer"} },
            new MenuModel{ Link = "/Fanti", Name = "在线繁体字转换器", catorgry = new Catorgry { Code = "developer"} },

            new MenuModel{ Link = "/Clipcss", Name = "CSS3剪贴路径生成器", catorgry = new Catorgry { Code = "image"} },

            new MenuModel{ Link = "/Passbuild", Name = "随机生成密码", catorgry = new Catorgry { Code = "developer"} },
            new MenuModel{ Link = "/Rmbdaxiaoxie", Name = "人民币大写转换器", catorgry = new Catorgry { Code = "academic"} },
            new MenuModel{ Link = "/Uplowcase", Name = "大小写转换", catorgry = new Catorgry { Code = "academic"} },

            new MenuModel{ Link = "/Color", Name = "网页颜色搭配", catorgry = new Catorgry { Code = "designer"} },
            new MenuModel{ Link = "/Topdsuffix", Name = "顶级域名后缀", catorgry = new Catorgry { Code = "webmaster"} },
            new MenuModel{ Link = "/LinuxSh", Name = "Linux sh应用程序查找、启动、停止命令", catorgry = new Catorgry { Code = "webmaster"} },

             new MenuModel{ Link = "/ColorWeb", Name = "网页颜色搭配", catorgry = new Catorgry { Code = "designer"} },
             new MenuModel{ Link = "/Excel2Json", Name = "Excel转Json", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/FileHash", Name = "文件Hash计算", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/Get2Json", Name = "Json、Get互转", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/HashView", Name = "Hash计算", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/ImageToBase64", Name = "Base64在线转图片", catorgry = new Catorgry { Code = "image"} },

             new MenuModel{ Link = "/JsonColor", Name = "JSON高亮着色工具", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/Jsontrans", Name = "JSON压缩转义", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/MetaBuild", Name = "在线Meta标签生成器", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/Morse", Name = "摩斯密码加密解密", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/PdfToJpg", Name = "PDF转JPG", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/Qrcode", Name = "二维码制作", catorgry = new Catorgry { Code = "image"} },
             new MenuModel{ Link = "/Regex", Name = "正则表达式", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/UniCode", Name = "Unicode转中文", catorgry = new Catorgry { Code = "developer"} },
             new MenuModel{ Link = "/UrlCode", Name = "URL编码/解码", catorgry = new Catorgry { Code = "developer"} },

             new MenuModel{ Link = "/hm_size", Name = "尺码对照表", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_mensshoes", Name = "男鞋", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_menssocks", Name = "男袜", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_ring", Name = "戒指", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_womenswear", Name = "女装", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_womensshoes", Name = "女鞋", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_lingerie", Name = "女士内衣", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_womenssocks", Name = "女袜", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_childrenswear", Name = "童装", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_childrenshoes", Name = "童鞋", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_childrensocks", Name = "童袜", catorgry = new Catorgry { Code = "inquiry"} },
             new MenuModel{ Link = "/hm_menswear", Name = "男装", catorgry = new Catorgry { Code = "inquiry"} },

             new MenuModel{ Link = "/Pinying", Name = "汉字转换拼音", catorgry = new Catorgry { Code = "academic"} },
             new MenuModel{ Link = "/Sequence", Name = "网址导航", catorgry = new Catorgry { Code = "navigation" } },
             new MenuModel{ Link = "/Software", Name = "推荐软件", catorgry = new Catorgry { Code = "navigation" } },

             new MenuModel{ Link = "/Xueba", Name = "学吧导航", catorgry = new Catorgry { Code = "navigation" } },
             new MenuModel{ Link = "/Nengso", Name = "网盘搜索", catorgry = new Catorgry { Code = "navigation" } },

             new MenuModel{ Link = "/LayuiFormCreate", Name = "Layui表单生成", catorgry = new Catorgry { Code = "designer" } },
             new MenuModel{ Link = "/layui.html", Name = "Layui样式生成器", catorgry = new Catorgry { Code = "designer" } },
             //new MenuModel{ Link = "/Themes.html", Name = "Layui样式生演示", catorgry = new Catorgry { Code = "designer" } },
             //new MenuModel{ Link = "/Theme.html", Name = "Layui皮肤演示", catorgry = new Catorgry { Code = "designer" } },
             //new MenuModel{ Link = "/skinread.html", Name = "Layui使用说明", catorgry = new Catorgry { Code = "designer" } },

             new MenuModel{ Link = "/layuidoc.html", Name = "Layui在线文档", catorgry = new Catorgry { Code = "designer" } },
             new MenuModel{ Link = "/kongmingqi.html", Name = "孔明棋", catorgry = new Catorgry { Code = "other" } },
             new MenuModel{ Link = "/air", Name = "在线空投快传", catorgry = new Catorgry { Code = "text" } },
             
        };
            int i = 0;
            int j = 0;
            foreach (var item in menus)
            {
                if (i > 26) { j++; i = 0; }
                item.Position = "-" + (j * 50) + "px -" + (i * 50) + "px;";
                item.catorgry.Name = Catorgrys().Where(x => x.Code == item.catorgry.Code).Select(x => x.Name).FirstOrDefault();
                i++;
            }
            if (navName.NotNullOrWhiteSpace())
                menus = menus.Where(x => x.Name.Contains(navName)).ToList();

            if (code.IsNullOrWhiteSpace())
                return menus;
            return menus.Where(x => x.catorgry.Code == code).ToList();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="navCode"></param>
        /// <returns></returns>
        public static (Catorgry catorgry,List<MenuModel> menus) MenusFor(string navCode) {
            //navCode = navCode.Replace("/", "");
            Catorgry catorgry = Menus(null,null).Where(x=>x.Link==navCode).Select(x=>x.catorgry).FirstOrDefault();
            List<MenuModel> menus = Menus(catorgry.Code, null);
            return (catorgry,menus);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static List<Catorgry> Catorgrys()
        {
            return new List<Catorgry> {
            new Catorgry { Code="text", Name="文本类" },
            new Catorgry { Code="document", Name="文档类" },
            new Catorgry { Code="image", Name="图像类" },
            new Catorgry { Code="sound", Name="音频类" },
            new Catorgry { Code="video", Name="视频类" },
            new Catorgry { Code="developer", Name="开发类" },
            new Catorgry { Code="webmaster", Name="运维类" },
            new Catorgry { Code="designer", Name="设计类" },
            new Catorgry { Code="academic", Name="学术类" },
            new Catorgry { Code="inquiry", Name="查询类" },
            new Catorgry { Code="navigation", Name="导航类" },
            new Catorgry { Code="other", Name="其它" },
            };
        }
    }
}
